package br.com.toscano.gobra.view;

import javax.inject.Inject;

import br.com.toscano.gobra.business.TipoLicitacaoBC;
import br.com.toscano.gobra.domain.TipoLicitacao;
import br.gov.frameworkdemoiselle.annotation.PreviousView;
import br.gov.frameworkdemoiselle.stereotype.ViewController;
import br.gov.frameworkdemoiselle.template.AbstractEditPageBean;
import br.gov.frameworkdemoiselle.transaction.Transactional;

@ViewController
@PreviousView("./tipoLicitacao_list.jsf")
public class TipoLicitacaoEditMB extends AbstractEditPageBean<TipoLicitacao, Long> {

	private static final long serialVersionUID = 1L;

	@Inject
	private TipoLicitacaoBC tipoLicitacaoBC;
	
	@Override
	@Transactional
	public String delete() {
		this.tipoLicitacaoBC.delete(getId());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String insert() {
		this.tipoLicitacaoBC.insert(getBean());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String update() {
		this.tipoLicitacaoBC.update(getBean());
		return getPreviousView();
	}
	

	@Override
	protected TipoLicitacao handleLoad(Long id) {
		setBean(this.tipoLicitacaoBC.load(id));
		return getBean();
	}


}